package uno.component;

public class CardFactory {
	
	/*
	 * Rappresentano le dimensioni delle carte.
	 * sono in questa classe e statici perche' 
	 * presumo che tutte le carte devono avere
	 * la stessa dimensione.
	 * 
	 *  la dimensione reale delle carte è 200 x 300 pixel
	 *  è importante mantenere la proporzione
	 * */
	private static int cardWidth = 90;
	private static int cardHeight = 135;
	
	/**
	 * Ritorna una carta normale
	 * 
	 * */
	public static Card createNormalCard(int number, String color, HandOfCard parent){		
		return new NormalCard(getCardWidth(), getCardHeight(), new CardValue(color, CardValue.NO_EFFECT, number), parent);		
	}
	
	
	/**
	 * Ritorna una carta speciale del tipo passato come parametro.
	 * 
	 * */
	public static Card createSpecialCard(int type, String color ,HandOfCard parent) {
		
		Card card = null;
		
		switch(type) {
		
		case CardValue.CHANGE_FLOW:
			
			card = new ChangeFlowCard(getCardWidth(), getCardHeight(), new CardValue(color, type),parent);
			break;
			
		case CardValue.ONE_STOP:

			card = new OneStopCard(getCardWidth(), getCardHeight(), new CardValue(color, type),parent);
			break;

		case CardValue.CHANGE_COLOR:

			card = new ChangeColorCard(getCardWidth(), getCardHeight(), new CardValue(type),parent);
			break;

		case CardValue.PLUS_TWO:
			
			card = new PlusTwoCard(getCardWidth(), getCardHeight(), new CardValue(color, type),parent);
			
			break;
			
		case CardValue.PLUS_FOUR:
		
			card = new PlusFourCard(getCardWidth(), getCardHeight(), new CardValue(type),parent);
		
		}
		
		return card;
		
	}

	/**
	 * @return the cardWidth
	 */
	public static int getCardWidth() {
		return cardWidth;
	}

	/**
	 * @param cardWidth the cardWidth to set
	 */
	public static void setCardWidth(int cardWidth) {
		CardFactory.cardWidth = cardWidth;
	}

	/**
	 * @return the cardHeight
	 */
	public static int getCardHeight() {
		return cardHeight;
	}

	/**
	 * @param cardHeight the cardHeight to set
	 */
	public static void setCardHeight(int cardHeight) {
		CardFactory.cardHeight = cardHeight;
	}
	
	
	

}
